/**
 * @file display.h
 * @author taylor peng
 * @brief 显示函数
 * @version 0.1
 * @date 2022-01-09
 * 
 * @copyright Copyright (c) 2022
 * 
 */
#ifndef _DISPLAY_H
#define _DISPLAY_H

#include <Arduino.h>
#include <U8g2lib.h>

/** U8G2字体类型 */
typedef enum
{
    LOGISOSO26_TF = 0,
    WQY12_T_GB2312,
    LOGISOSO38_TR,
} FONT_TYPE_E;

#define OLED_RESET_PIN      U8X8_PIN_NONE
#define OLED_CLK_PIN        22
#define OLED_DATA_PIN       21

extern U8G2_SSD1306_128X64_NONAME_F_HW_I2C Disp;

void Display_Init(void);
void Display_Clear(void);
void Display(void);
void Display_Pixel(unsigned short x_pos, unsigned short y_pos);
void Display_Utf(unsigned short x_pos, unsigned short y_pos, const char *str);
unsigned short Display_GetHeight(const char *str);
unsigned short Display_GetWidth(const char *str);
signed short Display_GetMaxCharHeight(void);
void Display_SetColor(unsigned short color);
unsigned char Display_GetColor(void);
void Display_Box(unsigned short x_pos, unsigned short y_pos, unsigned short w_pos, unsigned short h_pos);
void Display_RBox(unsigned short x_pos, unsigned short y_pos, unsigned short w_pos, unsigned short h_pos, unsigned short radius);
void Display_Framework(unsigned short x_pos, unsigned short y_pos, unsigned short w_pos, unsigned short h_pos);
void Display_VLine(unsigned short x_pos, unsigned short y_pos, unsigned short h_pos);
void Display_HLine(unsigned short x_pos, unsigned short y_pos, unsigned short w_pos);
void Display_String(unsigned short x_pos, unsigned short y_pos, const char *str);
void Display_Cursor(unsigned short x_pos, unsigned short y_pos);
void Display_Print(const char *str);
void Display_Font(unsigned char font_type);
void Display_Triangle(signed short x0_pos, signed short y0_pos, signed short x1_pos, signed short y1_pos, signed short x2_pos, signed short y2_pos);
void Display_SendF(const char *fmt, unsigned char cmd);
unsigned int Display_RefreshTickGet(void);
void Display_RefreshTickSet(void);
void Display_Printf(const char *str);

#endif
